package org.springleaf.core.mvc.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ContextHolder {


	private static ThreadLocal<HttpServletRequest> requestThreadLocal = new ThreadLocal<HttpServletRequest>();
	private static ThreadLocal<HttpServletResponse> responseThreadLocal = new ThreadLocal<HttpServletResponse>();
	
	
	public static HttpServletRequest getRequest(){
		return requestThreadLocal.get();
	}
	
	public static void setRequest(HttpServletRequest request){
		requestThreadLocal.set(request);
	}
	
	public static HttpServletResponse getResponse(){
		return responseThreadLocal.get();
	}
	
	public static void setResponse(HttpServletResponse response){
		responseThreadLocal.set(response);
	}
	
	public static void removeRequest(){
		requestThreadLocal.remove();
	}
	
	public static void removeResponse(){
		responseThreadLocal.remove();
	}
	
	
}
